#ifndef TYPES_H_
#define TYPES_H_

/*
	Copyright (C) 2011 Salil Bhagurkar

	This file is part of illusion

	illusion is free software: you can redistribute it and/or modify
	it under the terms of the GNU Lesser General Public License as
	published by the Free Software Foundation, either version 3 of
	the License, or (at your option) any later version.

	illusion is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with illusion. 
	If not, see <http://www.gnu.org/licenses/>.
*/

//
// File Visibility: KERNEL,ARCH
// Subsystem: KERNEL
// File Description: Kernel basic type definitions.
//

//
// Central types system that abstracts the default C types into portable ones.
// Only these definitions must be used across all kernel, platform and device
// driver code. TODO Fix arch and device driver code for using these types.
//

//
// These are based on what portably defines types to be of these sizes.
// The key types are u64, u32, s64, s32. 'int' was always found to be
// 32 bit and 'long long' was always found to be 64 bit.
//

typedef unsigned long long u64;
typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;

typedef long long s64;
typedef int s32;
typedef short s16;
typedef char s8;


//
// These types must be used for integers whose size will not exceed the
// the highest number possible by the bit width of the architecture. These
// probably provide some flexibility across architectures.
// TODO Add portability to this type.
//

typedef unsigned long uint_t;
typedef long int_t;


//
// When casting a pointer to an integer, cast to this type. This type is
// supposed to be portable across architectures.
// TODO Add portability to this type.
//

typedef unsigned long ptr_t;


typedef u8 bool;
#define true 1
#define false 0

#define null (void *)0

#endif /* TYPES_H_ */
